<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<%@ include file="/WEB-INF/jsp/inc/taglibs.jsp"%>
	<%@ include file="/WEB-INF/jsp/inc/meta.jsp"%>
   <script type="text/javascript" src="${approot}/resource/jquery/validate/jquery.validate.js"></script>
   <link href="${approot}/resource/jquery/validate/jquery.validate.css" rel="stylesheet" type="text/css" />
   <link href="${approot}/resource/jquery/validate/style.css" rel="stylesheet" type="text/css" />
     <script type="text/javascript">
            /* <![CDATA[ */
            jQuery(function(){
                jQuery("#c_money").validate({
                    expression: "if (VAL) return true; else return false;",
                    message: "充入金额不能为空"
                });
                jQuery("#c_money").validate({
                    expression: "if (VAL>0) return true; else return false;",
                    message: "充入金额不能小于0"
                });
                jQuery('#card').validated(function(){
					//alert("通过验证");
					do_add();
				});
            });
            /* ]]> */
        </script>
        
        <script type="text/javascript">
        function do_add()
        {   
            var str=$('#card').serializeObject();
            var jsons = $.toJSON(str);
            add_card(jsons);
        }


        function add_card(jsons){
 	       $.ajax({
 		   	url:'${approot}/admin/person/recharge_card',
 		   	dataType: 'json',
 		   	contentType: 'application/json',
 			data:jsons,
 			type:'post',
 			beforeSend:function(){
 			  // $('#main').disabled='true';
 			},
 			error:function(request){
 				alert(S);
 			},
 			success:function(data){
 			   if(data.msg=="error")
 			   {
 	 			   alert('系统异常，充值失败');
 			   }
 			   if(data.msg=="succ")
 			   {
 				  alert('充值成功');
 				  window.location.reload();
 			   }
 			}
 		   });
 		}
 	
        </script>
   
</head>  
  <body style="background:#E8F5FE; padding:15px 18px;" class="scroll_r">


<form method="post" action="${approot}/admin/person/recharge_card" id="card">
 <table border="0" cellpadding="0" cellspacing="1" width="92%" align="center" class="tab_l">
    <tr>
      <td><b>客户充值：</b></td>
      
    </tr>
  </table>
  <table border="0" cellpadding="0" cellspacing="1" width="92%" align="center" id="add_tab">
  <tr>
   <th>姓名：</th>
   <td><input type="text" name="" value="${person.personName }" id="name"><span style="color:#ff0000; margin:0;">*</span></td>
  </tr>
  <tr>
   <th>卡号：</th>
   <td><input type="text" name="" value="${card.cardNumber}" id="number"><span style="color:#ff0000; margin:0;">*</span></td>
  </tr>
  <tr>
   <th>余额：</th>
   <td><input type="text" name="" value="<c:if test="${!empty card.money}">${card.money}</c:if><c:if test="${empty card.money}">0</c:if>" id="money"><span style="color:#ff0000; margin:0;">*</span></td>
  </tr>
  <tr>
   <th>充入金额：</th>
   <td><input type="text" name="money" value="" id="c_money"><span style="color:#ff0000; margin:0;">*</span></td>
  </tr>
 </table>
  <p id="tab_but">
  <input type="hidden" name="cardId" value="${card.cardId }"/>
   <input type="submit" value="充 值"></p>
   
   
</form>

</body>
</html>
